package com.ruoyi.system.service.impl;

import com.ruoyi.system.entity.PreventionUnitStopItem;
import com.ruoyi.system.mapper.PreventionUnitStopItemMapper;
import com.ruoyi.system.service.PreventionUnitStopItemService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (PreventionUnitStopItem)表服务实现类
 *
 * @author makejava
 * @since 2023-06-26 11:18:11
 */
@Service("preventionUnitStopItemService")
public class PreventionUnitStopItemServiceImpl implements PreventionUnitStopItemService {
    @Resource
    private PreventionUnitStopItemMapper preventionUnitStopItemMapper;

    /**
     * 通过ID查询单条数据
     *
     * @return 实例对象
     */
    @Override
    public PreventionUnitStopItem queryById(Integer id) {
        return this.preventionUnitStopItemMapper.queryById(id);
    }

    /**
     * 分页查询
     *
     * @param preventionUnitStopItem 筛选条件
     * @return 查询结果
     */
    @Override
    public List<PreventionUnitStopItem> queryByPage(PreventionUnitStopItem preventionUnitStopItem) {
        List<PreventionUnitStopItem> preventionUnitStopItems = preventionUnitStopItemMapper.queryAllByLimit(preventionUnitStopItem);
        return preventionUnitStopItems;
    }

    /**
     * 新增数据
     *
     * @param preventionUnitStopItem 实例对象
     * @return 实例对象
     */
    @Override
    public PreventionUnitStopItem insert(PreventionUnitStopItem preventionUnitStopItem) {
        this.preventionUnitStopItemMapper.insert(preventionUnitStopItem);
        return preventionUnitStopItem;
    }

    /**
     * 修改数据
     *
     * @param preventionUnitStopItem 实例对象
     * @return 实例对象
     */
    @Override
    public PreventionUnitStopItem update(PreventionUnitStopItem preventionUnitStopItem) {
        this.preventionUnitStopItemMapper.update(preventionUnitStopItem);
        return this.queryById(preventionUnitStopItem.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.preventionUnitStopItemMapper.deleteById(id) > 0;
    }

    @Override
    public PreventionUnitStopItem queryByUnitNew(Integer id) {
        return preventionUnitStopItemMapper.queryByUnitNew(id);
    }

    @Override
    public List<PreventionUnitStopItem> queryAll(String beginOfDay, String endOfDay) {
        return preventionUnitStopItemMapper.queryAll(beginOfDay,endOfDay);
    }
}
